package com.biu.billiards.utils;

import java.time.LocalDateTime;
import java.util.Base64;

public class Xml {

    public static void main(String[] args) {




        String xml2 = "Version=0.0.1.0&TransCode=QACCBAL&BankCode=102&GroupCIS=120290001016415&zipFlag=0&ID=6609.y.1103.y.1103&PackageID=h7on61li2&Cert=&reqData=<?xml version=\"1.0\" encoding=\"U\"?>\n" +
                "<CMS>\n" +
                "    <eb>\n" +
                "        <pub>\n" +
                "            <TransCode>QACCBAL</TransCode>\n" +
                "            <CIS>110390003267826</CIS>\n" +
                "            <BankCode>102</BankCode>\n" +
                "            <ID>6609.y.1103.y.1103</ID>\n" +
                "            <TranDate>20230814</TranDate>\n" +
                "            <TranTime>082953877</TranTime>\n" +
                "            <fSeqno>h7on61li2</fSeqno>\n" +
                "        </pub>\n" +
                "        <in>\n" +
                "            <TotalNum>1</TotalNum>\n" +
                "            <BLFlag>0</BLFlag>\n" +
                "            <SynFlag>0</SynFlag>\n" +
                "            <rd>\n" +
                "                <iSeqno>55442571063364451</iSeqno>\n" +
                "                <AccNo>1103021009200566609</AccNo>\n" +
                "                <CurrType>001</CurrType>\n" +
                "                <ReqReserved3></ReqReserved3>\n" +
                "                <AcctSeq></AcctSeq>\n" +
                "            </rd>\n" +
                "        </in>\n" +
                "    </eb>\n" +
                "</CMS>";


        String xml = "<?xml version=\"1.0\" encoding = \"GBK\"?>\n" +
                "\t<CMS>\n" +
                "\t\t<eb>\n" +
                "\t\t\t<pub>\n" +
                "\t\t\t\t<TransCode>交易代码</TransCode>\n" +
                "\t\t\t\t<CIS>集团CIS号</CIS>\n" +
                "\t\t\t\t<BankCode>归属银行编号</BankCode>\n" +
                "\t\t\t\t<ID>证书ID</ID>\n" +
                "\t\t\t\t<TranDate>交易日期</TranDate>\n" +
                "\t\t\t\t<TranTime>交易时间</TranTime>\n" +
                "\t\t\t\t<fSeqno>指令包序列号</fSeqno>\n" +
                "\t\t\t</pub>\n" +
                "\t\t\t<in>\n" +
                "<QryfSeqno>待查指令包序列号</QryfSeqno>\n" +
                "<QrySerialNo>待查平台交易序列号</QrySerialNo>\n" +
                "\t\t\t</in>\n" +
                "\t\t</eb>\n" +
                "</CMS>";

        long currentTimeMillis = System.currentTimeMillis();

        String url = "http://192.168.231.181:448/servlet/ICBCCMPAPIReqServlet?userID=6609.у.1103.y.1103&PackageID=h7on61li2&SendTime="+currentTimeMillis;

     //   LocalDateTime now = LocalDateTime.now();


        //证书id：6609.у.1103.y.1103
        //客户的归属单位：102
        //客户的归属编码：110390003267826

      //  http://客户端NetSafe Client的地址和加密端口号/servlet/ICBCCMPAPIReqServlet?userID=证书ID&PackageID=包序列ID &SendTime=请求时间

    //  String read = "Version=0.0.0.1&TransCode=QBENDOS&BankCode=102&GroupCIS=110390003267826&zipFlag=0&ID=langxin07.y.1103&PackageID=h7olgqr1&Cert=&reqData=";
       String read = "Version=0.0.0.1&TransCode=QACCBAL&BankCode=102&GroupCIS=110390003267826&ID=6609.y.1103.y.1103&PackageID=QPAYENT&Cert=&reqData=";

        read=read+xml;

       System.out.println( HttpClientUtil.doPostXml(url,xml2));




    }

    // 编码为 Base64
    private static String encodeToBase64(String originalString) {
        byte[] encodedBytes = Base64.getEncoder().encode(originalString.getBytes());
        return new String(encodedBytes);
    }

    private static String decodeFromBase64(String encodeString) {
        byte[] decodedBytes = Base64.getDecoder().decode(encodeString);
        return new String(decodedBytes);
    }



}
